<?php
session_start();
ob_start();
include_once 'include/common.php';
$core = new core();
if (!$core->CheckLogin()) {
    header('Location:login.php');
}

$load_more = 0;
$list_order = $core->getListOrder(1, $load_more, 25);
?>
<!DOCTYPE html>
<html lang="en">
    <head>
        <!--
                Charisma v1.0.0

                Copyright 2012 Muhammad Usman
                Licensed under the Apache License v2.0
                http://www.apache.org/licenses/LICENSE-2.0

                http://usman.it
                http://twitter.com/halalit_usman
        -->
        <meta http-equiv="content-type" content="text/html; charset=utf-8"/>
        <meta http-equiv="content-language" content="vi"/>
        <title>Zen store</title>
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <meta name="description" content="Charisma, a fully featured, responsive, HTML5, Bootstrap admin template.">
        <meta name="author" content="Muhammad Usman">

        <!-- The styles -->
        <link id="bs-css" href="css/bootstrap-cerulean.css" rel="stylesheet">
        <style type="text/css">
            body {
                padding-bottom: 40px;
            }
            .sidebar-nav {
                padding: 9px 0;
            }
        </style>
        <link href="css/bootstrap-responsive.css" rel="stylesheet">
        <link href="css/charisma-app.css" rel="stylesheet">
        <link href="css/style.css" rel="stylesheet">
        <link href="css/jquery-ui-1.8.21.custom.css" rel="stylesheet">

        <link href='css/chosen.css' rel='stylesheet'>
        <link href='css/uniform.default.css' rel='stylesheet'>

        <link href='css/jquery.cleditor.css' rel='stylesheet'>


        <link href='css/jquery.iphone.toggle.css' rel='stylesheet'>

        <link href='css/uploadify.css' rel='stylesheet'>

        <!-- The HTML5 shim, for IE6-8 support of HTML5 elements -->
        <!--[if lt IE 9]>
          <script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
        <![endif]-->

        <!-- The fav icon -->
        <link rel="shortcut icon" href="img/favicon.ico">

    </head>

    <body>
        <div id="page-wrap" class="page-wrap body-wrap ">
            <div id="page-tray" class="tray transition">
                <?php include_once ('new_menu.php'); ?>

                <div id="page-content" class="page-content transition profile-page">
                    <?php include_once ('navbar.php'); ?>
                    <div class="container-fluid">
                        <div class="row-fluid">
                            <div id="content" class="span12">   
                                <!--                                <div>
                                                                    <ul class="breadcrumb">
                                                                        <li>
                                                                            <a href="#">Home</a> <span class="divider">/</span>
                                                                        </li>
                                                                        <li>
                                                                            <a href="#">Tables</a>
                                                                        </li>
                                                                    </ul>
                                                                </div>-->
                                <?php
                                if ($_SESSION["user_role"] != 3) {
                                    ?>
                                    <div class="row-fluid sortable">
                                        <div class="box span12">
                                            <div class="box-header well" data-original-title>
                                                <h2><i class="icon-edit"></i> Thêm đợt hàng</h2>

                                            </div>
                                            <div class="box-content">
                                                <div class="form-horizontal">
                                                    <fieldset>

                                                        <div class="control-group">
                                                            <label class="control-label" for="product_name">Tên đơn hàng* </label>
                                                            <div class="controls">
                                                                <input type="text" class="span6 typeahead" id="order_name"  >

                                                            </div>
                                                        </div>

                                                        <div class="control-group">
                                                            <label class="control-label" for="textarea2">Miêu tả order</label>
                                                            <div class="controls">
                                                                <textarea class="cleditor" id="order_des" rows="3"></textarea>
                                                            </div>
                                                        </div>

                                                        <div class="form-actions">
                                                            <input type="hidden" value="0" id="order_id">
                                                            <button type="submit" class="btn btn-primary" id="submit">Save changes</button>
                                                            <button type="reset" class="btn" id="reset">Cancel</button>
                                                        </div>
                                                    </fieldset>
                                                </div>   

                                            </div>
                                        </div><!--/span-->

                                    </div><!--/row-->
                                    <?php
                                }
                                ?>
                                <div class="row-fluid sortable">		
                                    <div class="box span12">
                                        <div class="box-header well" data-original-title>
                                            <h2><i class="icon-user"></i> Danh sách đợt hàng</h2>
                                            <div class="box-icon">

                                                <a href="#" class="btn btn-minimize btn-round"><i class="icon-chevron-up"></i></a>

                                            </div>
                                        </div>
                                        <div class="box-content">
                                            <input type="hidden" name="loadmore_order" id="loadmore_order" value="<?php echo $load_more; ?>">
                                            <input type="hidden" name="page_order" id="page_order" value="1">

                                            <table class="table table-striped table-bordered bootstrap-datatable datatable">
                                                <thead>
                                                    <tr>
                                                        <th>Order Name</th>
                                                        <th>Order Description</th>
                                                        <th>Create Time</th>
                                                        <th>Action</th>
                                                    </tr>
                                                </thead>   
                                                <tbody id="tbody_order_list">
                                                    <?php
                                                    if ($list_order) {
                                                        foreach ($list_order as $order) {
                                                            ?>
                                                            <tr>
                                                                <td> <a href="orderDetail.php?id=<?php echo $order->zen_order_id; ?>" ><?php echo $order->zen_order_name; ?></a></td>
                                                                <td class="center"><?php echo $order->zen_order_description; ?></td>
                                                                <td class="center"><?php echo date("d-m-y", strtotime($order->create_time)); ?></td>
                                                                <td class="center">
                                                                    <a href="orderDetail.php?id=<?php echo $order->zen_order_id; ?>" class="btn btn-success">
                                                                        <i class="icon-zoom-in icon-white"></i>  
                                                                        View                                            
                                                                    </a>
                                                                    <?php
                                                                    if ($_SESSION["user_role"] != 3) {
                                                                        ?>
                                                                        <a class="btn btn-info btn_edit_order" href="javascript:void(0)" rel="<?php echo $order->zen_order_id; ?>">
                                                                            <i class="icon-edit icon-white"></i>  
                                                                            Edit                                            
                                                                        </a>
                                                                        <a href="javascript:void(0)" class="btn btn-danger btn_delete_order" rel="<?php echo $order->zen_order_id; ?>">
                                                                            <i class="icon-trash icon-white"></i> 
                                                                            Delete
                                                                        </a>
                                                                        <?php
                                                                    }
                                                                    ?>
                                                                </td>
                                                            </tr>
                                                            <?php
                                                        }
                                                    }
                                                    ?>
                                                </tbody>
                                            </table>
                                            <div id="loading" style="display:none;width: 220px; height: 19px;margin: 0 auto;"><img title="img/ajax-loaders/ajax-loader-7.gif" src="img/ajax-loaders/ajax-loader-7.gif"></div>
                                        </div>
                                    </div><!--/span-->

                                </div><!--/row-->


                            </div><!--/#content.span10-->

                        </div><!--/fluid-row-->

                        <?php include_once ('footer.php'); ?>
                    </div><!--/.fluid-container-->
                </div>
            </div>
        </div>
        <!-- external javascript
        ================================================== -->
        <!-- Placed at the end of the document so the pages load faster -->

        <!-- jQuery -->
        <script src="js/jquery-1.7.2.min.js"></script>
        <!-- jQuery UI -->
        <script src="js/jquery-ui-1.8.21.custom.min.js"></script>
        <!-- transition / effect library -->
        <script src="js/bootstrap-transition.js"></script>
        <!-- alert enhancer library -->
        <script src="js/bootstrap-alert.js"></script>
        <!-- modal / dialog library -->
        <script src="js/bootstrap-modal.js"></script>
        <!-- custom dropdown library -->
        <script src="js/bootstrap-dropdown.js"></script>
        <!-- scrolspy library -->
        <script src="js/bootstrap-scrollspy.js"></script>
        <!-- library for creating tabs -->
        <script src="js/bootstrap-tab.js"></script>
        <!-- library for advanced tooltip -->
        <script src="js/bootstrap-tooltip.js"></script>
        <!-- popover effect library -->
        <script src="js/bootstrap-popover.js"></script>
        <!-- button enhancer library -->
        <script src="js/bootstrap-button.js"></script>
        <!-- accordion library (optional, not used in demo)menu scroll -->
        <script src="js/bootstrap-collapse.js"></script>

        <!-- autocomplete library -->
        <script src="js/bootstrap-typeahead.js"></script>

        <!-- library for cookie management -->
        <script src="js/jquery.cookie.js"></script>
        <script src='js/jquery.dataTables.min.js'></script>


        <!-- select or dropdown enhancer -->
        <script src="js/jquery.chosen.min.js"></script>
        <!-- checkbox, radio, and file input styler -->
        <script src="js/jquery.uniform.min.js"></script>

        <!-- rich text editor library -->
        <script src="js/jquery.cleditor.min.js"></script>
        <!-- for iOS style toggle switch -->
        <script src="js/jquery.iphone.toggle.js"></script>
        <!-- autogrowing textarea plugin -->
        <script src="js/jquery.autogrow-textarea.js"></script>

        <!-- history.js for cross-browser state change on ajax -->
        <script src="js/jquery.history.js"></script>
        <!-- application script for Charisma demo -->
        <script src="js/common.js?t=1"></script>
        <script src="js/orderList.js?t=3"></script>



    </body>
</html>


